home *** CD-ROM | disk | FTP | other *** search
/ Compute! Gazette 1995 February / 1995-02b.d64 / number filter (.txt) < prev    next >
Commodore BASIC  |  2022-09-20  |  3KB  |  54 lines

  1. 100 :
  2. 110 rem number filter ml routine
  3. 120 :
  4. 130 rem form: sys z, x$, y$, x
  5. 140 rem where z is the start address
  6. 150 rem       x$ stores the result
  7. 160 rem       y$ is the filter string
  8. 170 rem and   x is the number to filter
  9. 180 :
  10. 190 rem for example:
  11. 200 rem   sys 49152,a$,"fcffdvaa",x*.14
  12. 210 :
  13. 220 s=49152:print"relocate to "right$("    "+str$(s),6)"[157][157][157][157][157][157][157]";:input s
  14. 230 if(s>3000 and s<40959)or(s>49151 and s<53247)then250
  15. 240 print"out of bounds!":goto220
  16. 250 x=s:z=0:c=0:restore:print"poking"
  17. 260 read y:if y<256 then poke x,y:z=z+y:x=x+1:c=c+y:print".";:goto260
  18. 270 print:print"relocating":if y<>999 then print"error in data":stop
  19. 280 read y:if y<>c then print"checksum error"c","y:stop
  20. 290 read x:print".";:if x<0 then320
  21. 300 p=peek(s+x)+256*peek(s+x+1)-49152+s:poke s+x+1,p/256
  22. 310 poke s+x,p-peek(s+x+1)*256:goto290
  23. 320 end
  24. 330 rem layout: 1-ml data; 2-'999'; 3-checksum; 4-relocation offset; 5-'-1'
  25. 340 data 32,253,174,32,139,176,133,73,132,74,32,253,174,32,158,173,32,82,170
  26. 350 data 160,2,177,73,153,2,0,136,16,248,168,240,4,201,120,144,3,76,113,165
  27. 360 data 32,253,174,32,158,173,32,221,189,32,56,192,169,25,133,22,96,32,154
  28. 370 data 193,24,102,27,164,7,200,196,2,176,10,230,7,177,3,32,98,192,24,144
  29. 380 data 239,164,22,240,14,56,102,27,136,198,22,177,3,32,98,192,24,144,238
  30. 390 data 96,133,25,132,26,162,10,32,116,192,176,2,165,25,164,26,145,3,96,202
  31. 400 data 16,2,56,96,221,139,192,208,246,138,10,170,189,150,192,72,189,149,192
  32. 410 data 72,24,96,90,83,65,78,77,70,80,67,68,86,168,192,196,192,188,192,193
  33. 420 data 192,209,192,206,192,244,192,11,193,52,193,184,192,173,1,1,201,48,208
  34. 430 data 13,173,2,1,208,8,169,32,56,96,169,46,56,96,32,85,193,56,96,169,32
  35. 440 data 44,169,43,36,28,16,2,169,45,56,96,162,42,44,162,32,169,36,133,29,134
  36. 450 data 32,36,27,16,223,32,85,193,176,16,200,177,3,201,48,144,6,201,58,176
  37. 460 data 2,166,29,138,133,29,56,96,169,32,36,27,48,8,36,28,16,2,169,41,56,96
  38. 470 data 170,169,40,36,28,48,204,16,177,200,196,120,240,18,177,3,201,82,208
  39. 480 data 12,36,28,48,2,24,96,169,32,145,3,56,96,136,36,27,16,149,166,32,32
  40. 490 data 85,193,144,175,230,6,169,44,56,96,200,196,120,240,18,177,3,201,66
  41. 500 data 208,12,36,28,16,2,24,96,169,32,145,3,56,96,32,85,193,176,2,169,48
  42. 510 data 56,96,134,30,132,31,166,27,48,14,160,48,166,5,189,0,1,240,28,230,5
  43. 520 data 232,208,9,164,29,166,6,240,17,198,6,202,189,0,1,201,48,144,7,201,58
  44. 530 data 176,3,56,176,2,152,24,166,30,164,31,96,162,255,168,232,152,221,0,1
  45. 540 data 240,6,189,0,1,208,244,24,96,169,69,32,137,193,144,13,164,2,169,42
  46. 550 data 136,145,3,136,16,251,104,104,96,169,46,32,137,193,134,5,134,6,160
  47. 560 data 0,177,3,201,86,240,5,200,196,2,208,245,132,22,136,132,7,173,0,1,201
  48. 570 data 45,102,28,169,32,133,29,133,32,96
  49. 580 data 999,48885
  50. 590 data 49,57,74,92,105,122,130,134
  51. 600 data 149,151,153,155,157,159,161
  52. 610 data 163,165,167,190,223,299,333
  53. 620 data 413,433,-1
  54.